package com.itheima.demo03;

import java.util.TreeMap;

public class Demo02 {

    public static void main(String[] args) {

        Student s1 = new Student("baofei",29);
        Student s2 = new Student("baofeng",19);
        Student s3 = new Student("baobi",12);

        TreeMap<Student,String> treeMap = new TreeMap<>();

        treeMap.put(s1,"ren");
        treeMap.put(s2,"dajian");
        treeMap.put(s3,"juchi");

        treeMap.forEach((s,s4) ->{
            String name = s.getName();
            int age = s.getAge();

            System.out.println(name+"-----"+age+"-----"+s4);
        });
    }
}
